<template>
<div class="page">
    <VueAudio 
        :url="info.musiclink" 
        ref="vueAudio"
        @setMaxTime="getMaxTime"
        @setResidue="getResidue"
    ></VueAudio>
    <div class="personage clearfix">
        <div class="personage-header clearfix">
            <div style="position:relative" class="header-header" @click="playFn()">
                <img :src="info.tspicture" alt="">
                <i class="iconfont icon-zanting- header-icon" v-show="!!openState"></i>
                <i class="iconfont icon-bofanganjian header-icon" v-show="!openState"></i>
            </div>
            
            <div class="personage-header-cont clearfix">
                <h3>{{ info.name || ''}}</h3>
                <p>{{ info.tsname || ''}}</p>
                <div class="personage-size">
                    <span style="margin-right:30px;">专辑  {{ info.albumname || ''}}</span>
                    <span>发行时间  {{info.publishtime || ''}}</span>
                </div>

                <div class="personage-btn" style="margin-top:16px;">
                    <a href="javascript:;" style="background-color: #823117;" @click="playFn()">
                        <span style="color: #FFF;">
                            <i class="iconfont icon-zanting-" style="font-size:12px; margin-right:10px" v-show="!!openState"></i>
                            <i class="iconfont icon-bofanganjian" style="font-size:12px; margin-right:10px" v-show="!openState"></i>
                            {{ !!openState ? '暂停' : '播放' }}
                        </span>
                    </a>
                    <!-- <a href="javascript:;" style="background-color: #fff;"><span style="color: #823117;">分享  280.4万万</span></a> -->
                </div>
            </div>
        </div>

        <div class="personage-content clearfix">
            <div class="personage-song-list fl clearfix">
                <div class="you-like-title"><span></span>歌词</div>

                <div class="play-cont-s" v-html="info.lyric">
                </div>
                
            </div>

            <div class="you-like clearfix">
                <div class="you-like-title"><span></span>猜你喜欢</div>

                <div class="you-like-list">
                    <div class="you-like-list-cont" v-for="(item, index) of recommendList" :key="index"  @click="routerLink(`/main/index?tsid=${item.tsid}`)">
                        <img :src="item.picture" alt="">
                        <p>{{ item.name }}</p>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <!-- <div class="playTool">
        <div class="playToolCont clearfix">
            <div class="palyCont fl" style="width:80px; margin-right:20px">
                <i class="iconfont icon-bofang" @click="play()" v-show="!openState" style="font-size:40px; color:#fff"></i>
                <i class="iconfont icon-zanting-1" @click="play()" v-show="!!openState" style="font-size:40px;  color:#fff"></i>
            </div>
            <div class="playprocess fl">
                <div class="playprocess-top clearfix">
                    <span class="fl">{{info.name}} - {{info.tsname}}</span>
                    <span class="fr">{{ residueTime }}</span>
                </div>
                <div class="playProcess-bottom">
                    <el-slider v-model="residue" @change="changeProccess" :show-tooltip="false"></el-slider>
                </div>
            </div>
        </div>
    </div> -->
</div>
</template>
<script>
import VueAudio from "../components/vueAudio.vue"
import {getResponse, getResponses} from "../api"

export default {
    data(){
        return {
            // audioSrc:'http://piocwwq1n.bkt.clouddn.com/music1.mp3',
            openState:false,
            musicid:'',
            recommendList:'',
            tsid:'',
            albumid:'',
            list:[],
            total:[],
            pagenum:1,
            pagesize:10,
            info:{},
            maxTime:'',
            residue:0,
            residueTime:'00:00:00',
            src:'',
            index:0
        }
    },

    components:{
        VueAudio
    },

    methods:{
        routerLink(url){
            this.$router.push(url)
        },

        playFn(){
            this.openState = !this.openState
            this.$refs['vueAudio'].startPlayOrPause()
        },

        async getMusic() {
             const data = await getResponses(`/fochina/query/music/json`,`musicid=${this.musicid}`)

            if(data.code === '0000') {
               this.info = data.data[0]

               if( this.list.length > 0) {
                    this.info = this.list[0]
                    this.residueTime = this.info.playtime
                }
                
               this.getRecommend()
            } else {
                console.log(data.error)
            }
        },

        // 推荐法师
        async getRecommend() {
            const data = await getResponses(`/fochina/query/topicsubjectrecommend/json`,`tsid=${this.info.tsid}`)

            if(data.code === '0000') {
                this.recommendList	= data.data

            } else {
                console.log(data.error)
            }
        },

        // play() {
        //     this.openState = !this.openState
        //     this.$refs['vueAudio'].startPlayOrPause()
        // },

        // 进度拖动 歌曲
        changeProccess(index) {
            this.$refs['vueAudio'].changeCurrentTime(index)
        },

        //获取当前音乐时常
        getMaxTime(time) {
            this.maxTime = time
            console.log(time)
        },

        //获取当前播放进度
        getResidue(residueTime, residue) {
            this.residue = residue
            this.residueTime = residueTime
        }
    },

    mounted() {
        !!this.$route.query.musicid && (this.musicid = this.$route.query.musicid)
        this.getMusic()
    }
}
</script>

<style>
.you-like-title span{
    display: inline-block;
    width: 0;
    height: 0;
    border-top: 3px solid transparent;
    border-left: 6px solid #823117;
    border-bottom: 3px solid transparent;
    float:left;
    position: relative;
    top:50%;
    transform:translateY(-50%);
    margin-right:8px
}

.personage,.personage-content{
    width:100%;
}

.personage-header {
    width:100%;
    min-height: 200px;
    padding:20px 0;
    background-color: #F7F7F7;
}

.personage-header img {
    width:200px;
    height: 200px;
    border-radius: 50%;
    float: left;
    margin-left:53px;
    margin-right:38px;
}

.personage-header .header-header {
    float:left;
    width:292px;
}

.personage-header .header-header i {
    color:#fff;
    font-size:60px;
    position: absolute;
    top:50%;
    left:50%;
    margin-left:8px;
    transform: translate(-50%, -50%);
    display: none;
}

.personage-header .header-header:hover i {
    display: block;
}

.personage-header .personage-header-cont {
    width: 620px;
    float: left;
}

.personage-header-cont h3 {
    font-size: 28px;
    color: #333333;
    height: 40px;
    margin-bottom: 14px;
}

.personage-header-cont p {
    font-family: PingFangSC-Regular;
    font-size: 12px;
    color: #333333;
    line-height: 18px;
}

.personage-size {
    margin-top:16px;
}

.personage-size span {
    font-size: 14px;
    color: #333;
    display: inline-block;
    min-width: 116px;
}

.personage-size span em {
    font-style: normal;
    font-family: PingFangSC-Regular;
    font-size: 20px;
    color: #333333;
    margin-left:14px;
    margin-top:-2px;
}

.personage-btn a {
    display: inline-block;
    padding:0 24px;
    height: 40px;
    line-height: 40px;
    text-align: center;
    border-radius: 100px;
    margin-right:16px;
    border: 1px solid #823117;
    margin-top:18px;
    width:auto!important;
}

.personage-btn span {
    font-size: 14px;
}

.personage-song-list,.personage-song-list-cont {
    width:680px;
}

.personage-song-header{
    height: 32px;
    line-height: 32px;
    padding-top:18px;
    border-bottom: 4px solid #C6A4A4;
    margin-bottom:20px;
}

.personage-song-header span{
    display: inline-block;
    font-size: 16px;
    color: #333;
    min-width: 90px;
    height: 32px;
    line-height: 32px;
    margin-bottom: -4px;
    margin-right:24px;
    padding-left:12px;
    border-bottom: 4px solid #C6A4A4;
}

.personage-song-header span.active {
    border-bottom: 4px solid #823117;
    color: #823117;
}

.personage-song-list-title{
    background-color: #F6F6F6;
    text-align: left;
    font-size: 12px;
    color: #999;
    line-height: 40px;
}

.personage-song-list-one {
    width:338px;
    padding-left:6px;
    height: 58px;
    float: left;
}

.personage-song-list-two {
    width:239px;
    height: 58px;
    float: left;
}

.personage-song-list-three {
    width:67px;
    height: 58px;
    float: left;
}

.personage-song-list-l {
    width:680px;
    height: 58px;
    line-height: 58px;
    border-bottom: 1px solid #E9EAEC;
    font-size: 14px;
    color: #333333;
}


.personage-song-list-l .personage-song-list-one span {
    color:#999;
    font-size: 14px;
}

.personage-song-list-l .personage-song-list-three {
    font-size: 12px;
    color: #999;
}

.you-like {
    width:300px;
    float:right;
    padding-left:20px;
}

.you-like-title{
    height: 32px;
    line-height: 32px;
    padding-top:18px;
    border-bottom: 4px solid #fff;
    margin-bottom:20px;
    font-size: 16px;
    color: #000000;
}

.you-like-list-cont {
    width:120px;
    margin:0 0 30px 30px;
    float: left;
}

.you-like-list-cont img {
    width:120px;
    height: 120px;
    border-radius: 100%;
}

.you-like-list-cont p {
    font-size: 14px;
    color: #333333;
    text-align: center;
    height: 20px;
    width:100%;
    margin-top:9px;
}

.play-cont-s {
    width:679px;
    height: 700px;
    font-size: 16px;
    line-height: 24px;
    color: #333333;
    overflow-y: auto;
    -ms-overflow-style: none;
}

.play-cont-s::-webkit-scrollbar{
	width: 10px;
	background-color: #fff;
}

.play-cont-s::-webkit-scrollbar-thumb
{
    background: #E9EAEC;
    border-radius: 100px;
}


.playVoice {
    width:128px;
    padding-top:24px;
}



.playVoice-r {
    width:100px;
}

.playProcess-bottom {
    margin-top:14px;
    background: rgba(255,255,255,0.30);
    border-radius: 100px;
    width:100%;
    height: 4px;
    position: relative;
    
}

.playOrder {
    line-height: 80px;
    margin-right:20px;
}

.playOrder i,.playVoice i{
    font-size:28px;
    color:#fff
}

.palyCont {
   width:126px; 
   line-height: 80px;
   margin-right:80px;
}

.process-btn {
    background: #fff;
    border-radius: 100px;
    height: 4px;
}

.process-radio {
    position:absolute;
    top:50%;
    transform: translateY(-50%);
    width:10px;
    height: 10px;
    border-radius: 100%;
    background: #fff;
}

.playprocess {
    width:520px;
    margin-right:97px;
}

.playprocess-top {
    padding-top: 18px;
    width:520px;
}

.playprocess-top span {
    font-family: PingFangSC-Regular;
    font-size: 16px;
    color: #FFFFFF;
    
}


.playToolCont {
    width:1000px;
    height: 80px;
    margin:0 auto;
}

.playTool {
    width:100%;
    height: 80px;
    position:fixed;
    left:0;
    bottom:0;
    background: rgba(0,0,0,0.60);
}
.play-r {
    width:270px;
    text-align: center;
    float: right;
    cursor: pointer;
}

.play-r img {
    width:72px;
    height: 72px;
    border-radius:50%;
    margin:0 auto 10px;
}


.playProcess-bottom .el-slider__runway {
    background: rgba(255,255,255,0.30);
    border-radius: 100px;
    width: 100%;
    height: 4px;
    position: relative;
    margin: 0;
}

.playProcess-bottom .el-slider__button-wrapper {
    width: 10px;
    height: 10px;
    position: absolute;
    z-index: 1001;
    top:50%;
    transform: translateY(-50%);
    left:0;
    margin:0;
}
.playProcess-bottom .el-slider__bar {
    height:4px;
    background-color: #fff;
    border-top-left-radius:2px;
    border-bottom-left-radius: 2px;
    position: absolute;
}

.playProcess-bottom .el-slider__button {
    /* position: absolute;
    top: 50%;*/
    transform: translateY(-50%); 
    width: 10px;
    height: 10px;
    border-radius: 100%;
    background: #fff;
    border:none;
    background-color: #fff;
    border-radius: 50%;
    transition: .2s;
}
.playProcess-bottom .process-radio {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 10px;
    height: 10px;
    border-radius: 100%;
    background: #fff;
}

</style>